import {RouteRecordRaw} from "vue-router";
import HomeView from "../views/HomeView.vue";
import QuestionSubmitList from "../views/QuestionSubmitList.vue";
import NoAuth from "../views/NoAuth.vue";
import HelloWorld from "@/components/HelloWorld.vue";
// @ts-ignore
import UserLayout from "@/layouts/UserLayout";
import Register from "@/components/Register.vue";
import Login from "@/components/Login.vue";
// @ts-ignore
import AddQuestionView from "@/views/question/AddQuestionView.vue"
import ViewQuestionsView from "@/views/question/ViewQuestionsView.vue"
import MangerQuestionView from "@/views/question/MangerQuestionView.vue"
import QuestionsView from "@/views/question/QuestionsView.vue"
import {ACCESS_ENUM} from "@/access/accessEnum";
export let routes: Array<RouteRecordRaw>;
routes = [

    {
        path: "/user",
        name: "用户",
        component: UserLayout,
        meta: {
            hiddenInMenu: true
        },
        children: [{
            path: '/user/login',
            name: '登录',
            component: Login
        },
            {
                path: '/user/register',
                name: '注册',
                component: Register
            }
        ]
    },
    {
        path: "/",
        name: "首页",
        component: HomeView,
    },
    {
        path: "/question",
        name: "浏览题目",
        component: QuestionsView,
    },
    {
        path: "/view/question/:id",
        name: "做题",
        props:true,
        component: ViewQuestionsView,
        meta:{
            hiddenInMenu: true
        }
    },
    {
        path: "/questionSubmitList",
        name: "提交列表",
        component: QuestionSubmitList,

    },
    {
        path: "/noAuth",
        name: "无权限",
        component: NoAuth,
        meta: {
            hiddenInMenu: true
        }
    },
    {
        path: "/addQuestion",
        name: "创建题目",
        component: AddQuestionView,
        meta: {
            access: ACCESS_ENUM.ADMIN,
            hiddenInMenu: true
        }
    },
    {
        path: "/updateQuestion/:id",
        name: "修改题目",
        component: AddQuestionView,
        meta: {
            access: ACCESS_ENUM.ADMIN,
            hiddenInMenu: true
        }
    },
    {
        path: "/mangerQuestion",
        name: "题目管理",
        component: MangerQuestionView,
        meta: {
            access: ACCESS_ENUM.ADMIN
        }
    },
    {
        path: "/about",
        name: "关于我的",
        component: () =>
            import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
    },
];

